# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Gavin Lloyd <gavinhungry@gmail.com>

pkgname=acme.sh
pkgver=3.0.7
pkgrel=1
pkgdesc='An ACME Shell script, an acme client alternative to certbot'
arch=('any')
url='https://github.com/acmesh-official/acme.sh'
license=('GPL3')
depends=('bash')
optdepends=('socat: for standalone mode'
            'oath-toolkit: Used to compute the OTP for some DNS providers')
source=("$pkgname-$pkgver.tar.gz::${url}/archive/refs/tags/${pkgver}.tar.gz")
sha512sums=('83d080b461662bf2c5cfa9cb51aaf41d7f873f54908e2e5f94d7e3fe8e3f6953d73aafb66adc97455aa958f37c72ef77ba475c7d7cbb3ca3c5bbffb4937c4bae')

package() {
  cd $pkgname-$pkgver

  install -dm755 "$pkgdir"/usr/share/acme.sh/deploy
  install -dm755 "$pkgdir"/usr/share/acme.sh/dnsapi
  install -dm755 "$pkgdir"/usr/share/acme.sh/notify
  install -dm755 "$pkgdir"/usr/bin

  install -m755 acme.sh "$pkgdir"/usr/share/acme.sh/
  install -m755 deploy/*.sh "$pkgdir"/usr/share/acme.sh/deploy/
  install -m755 dnsapi/*.sh "$pkgdir"/usr/share/acme.sh/dnsapi/
  install -m755 notify/*.sh "$pkgdir"/usr/share/acme.sh/notify/

  ln -s /usr/share/acme.sh/acme.sh "$pkgdir"/usr/bin/acme.sh
}
